package mywebapps.beans;

import javax.enterprise.context.RequestScoped;
import javax.inject.Named;

import org.springframework.security.context.SecurityContextHolder;
import org.springframework.security.userdetails.UserDetails;

@Named("userBean")
@RequestScoped
public class UserBean {	
	public boolean isLoggedIn() {
		Object principalObj = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
		if(principalObj instanceof UserDetails) {
			return true;
		}
		
		return false;
	}
}
